<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let num = parseInt(prompt("请输入一个数字："));
        i = 2;
        while (i <= num) {
            if (num % i == 0) {
                break;
            }
            else {
                i++;
            }
        }
        console.log(i === num ? `${num}是质数` : `${num}不是质数`);
        console.log(`i的值为：${i}`);
    </script>
</body>
</html>